Added PlayStation device provider implementation (DS4/DS5 Lightbars)#454
Added PlayStation device provider implementation (DS4/DS5 Lightbars)#454logicallysynced wants to merge 2 commits into
Conversation
…lSense Edge) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
I have recently worked with Claude Code to implement this into Chromatics. I thought I would share the outcome with everyone here in case there was additional interest. |
|
This is great! LED update works while keeping game's adaptive trigger and vibration functions, whereas OpenRGB breaks them. Hotplug support works great. Only problem I had is while using USB connection, LED color only updates once. That may be an incompatibility I have with Steam interfering |
|
Interesting, was this with a DS5? I only have a DS4 to test with and didn’t have any issues with USB, but can revisit with Claude 😅 Does BT work fine? |
…teFile Field reports against the USB transport showed lightbar updating once and then freezing. Root cause: HidSharp's HidStream opens its handle with FILE_FLAG_OVERLAPPED and runs an asynchronous WriteFile + GetOverlappedResult dance. The PlayStation HID minidriver returns failure on the second and subsequent overlapped writes, which HidSharp surfaces as IOException — the queue's catch handler then suspends the queue. Reintroduced HidRawWriter (synchronous Win32 WriteFile on a separate kernel handle, BOOL return — never throws). On Windows, both DS4 and DS5 queues prefer the raw writer; on non-Windows the queues fall back to HidStream.Write since HidSharp's macOS/Linux paths don't share the overlapped Windows code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Made some changes with Claude, let me know if the experience is any better when you get a chance. |
|
USB now also works with DualSense (PS5) |
Summary
New
RGB.NET.Devices.PlayStationprovider for Sony's PlayStation controllers — DualShock 4 (PS4), DualSense, and DualSense Edge (PS5). Both USB and Bluetooth transports.Speaks raw HID via the existing HidSharp dependency through
RGB.NET.HID— no Sony driver, no DS4Windows, no SignalRGB, no HidHide, no DualSenseX.Hot-plug aware: subscribes to
DeviceList.Local.Changed, debounced reconcile (1500ms) to handle PnP bursts cleanly, plus a per-frame liveness pre-check to close the race between unplug and the next 30Hz trigger tick.Output report layouts mirror Linux's
hid-playstationdriver. CRC-32/zlib (with Sony's0xA2output-report seed byte) is implemented inPlayStationCrc32for the BT report variants.Supported devices
0x05C40x09CC0x0BA00x0CE60x0DF2LEDs exposed
Custom1(lightbar)Custom1(lightbar) +Custom2..Custom6(5 monochrome player indicator LEDs)Custom1is the lightbar on both controller families so a host-side mapping carries sensible meaning across DS4 and DS5The DualSense mic-mute LED is intentionally not exposed. The mic-mute button mutes the microphone in hardware regardless of host activity, so taking control of the LED would suppress visual feedback for an action that still happens. The provider does not set the
MIC_MUTE_LED_CONTROL_ENABLEbit invalid_flag1, so the firmware retains its default LED-tracks-mute-state behaviour.Coexistence / known limitations
TryOpenfails and the controller is skipped with aTrace.WriteLinediagnostic.valid_flagbits are clear so games / Steam Input continue to drive them normally.DeviceName.Full design notes + protocol references in
RGB.NET.Devices.PlayStation/README.md.Test plan
net10.0,net9.0,net8.0(full solutiondotnet build— 0 errors, 0 new warnings)🤖 Generated with Claude Code